﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZOVNP.Model.Abstracts;

namespace ZOVNP.Engine
{
    [DomainObject(typeof(IOrderPartHelp))]
    public partial class OrderPartHelp : IOrderPartHelp
    {
        private IDomainReference<IOrderPartHelp> _parentPartLocker;
        private IDomainCollection<IOrderPart> _orderPartsLocker;
        private IDomainCollection<IOrderPartHelp> _childPartsLocker;

        public OrderPartHelp()
        {
            _parentPartLocker = new SmartReference<OrderPartHelp, OrderPartHelp, IOrderPartHelp>(this, OrderPartHelp2Reference, it => it._ParentPartID);
            _orderPartsLocker = new SmartCollection<OrderPart, IOrderPart>(this, OrderParts);
            _childPartsLocker = new SmartCollection<OrderPartHelp, IOrderPartHelp>(this, OrderPartHelp1);
        }

        public IDomainReference<IOrderPartHelp> ParentPartReference
        {
            get { return _parentPartLocker; }
        }

        public IOrderPartHelp ParentPart
        {
            get
            {
                return _parentPartLocker.Value;
            }
            set
            {
                _parentPartLocker.Value = value;
            }
        }

        IDomainCollection<IOrderPart> IOrderPartHelp.OrderParts
        {
            get { return _orderPartsLocker; }
        }

        public IDomainCollection<IOrderPartHelp> ChildParts
        {
            get { return _childPartsLocker; }
        }
    }
}
